<!DOCTYPE html>
<html>
<head>
    <head th:include="header :: header"></head>
    <title></title>
    <style>
        .content-wrapper, .main-footer{
            margin-left: unset;
        }
        #plansArea{
            background-color: #f1f1f1;
            padding-left: 15px;
        }
        .skin-blue .wrapper, .skin-blue .main-sidebar, .skin-blue .left-side{
            background-color: unset;
        }
    </style>
</head>
<body>
<div class="wrapper">

    <div class="input-group">
        <span class="input-group-addon">Cron表达式:</span>
        <input type="text" class="form-control" id="cron" placeholder="输入Cron表达式:" style="width: 500px">
        <button type="button" class="btn btn-primary" onclick="plans('5')">近5次执行计划</button>
        <button type="button" class="btn btn-primary" onclick="plans('30')">近30次执行计划</button>
        <button type="button" class="btn btn-primary" onclick="plans('60')">近60次执行计划</button>
    </div>
    <div id="plansArea">

    </div>
	<!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code><span class="pun">基础配置：</span></code></li><li class="L1"><code><span class="pln">    </span><span class="pun">-</span><span class="pln"> </span><span class="pun">执行器：任务的绑定的执行器，任务触发调度时将会自动发现注册成功的执行器,</span><span class="pln"> </span><span class="pun">实现任务自动发现功能;</span><span class="pln"> </span><span class="pun">另一方面也可以方便的进行任务分组。每个任务必须绑定一个执行器,</span><span class="pln"> </span><span class="pun">可在</span><span class="pln"> </span><span class="str">"执行器管理"</span><span class="pln"> </span><span class="pun">进行设置;</span></code></li><li class="L2"><code><span class="pln">    </span><span class="pun">-</span><span class="pln"> </span><span class="pun">任务描述：任务的描述信息，便于任务管理；</span></code></li><li class="L3"><code><span class="pln">    </span><span class="pun">-</span><span class="pln"> </span><span class="pun">负责人：任务的负责人；</span></code></li><li class="L4"><code><span class="pln">    </span><span class="pun">-</span><span class="pln"> </span><span class="pun">报警邮件：任务调度失败时邮件通知的邮箱地址，支持配置多邮箱地址，配置多个邮箱地址时用逗号分隔；</span></code></li><li class="L5"><code></code></li><li class="L6"><code><span class="pun">触发配置：</span></code></li><li class="L7"><code><span class="pln">    </span><span class="pun">-</span><span class="pln"> </span><span class="pun">调度类型：</span></code></li><li class="L8"><code><span class="pln">        </span><span class="pun">无：该类型不会主动触发调度；</span></code></li><li class="L9"><code><span class="pln">        CRON</span><span class="pun">：该类型将会通过</span><span class="pln">CRON</span><span class="pun">，触发任务调度；</span></code></li><li class="L0"><code><span class="pln">        </span><span class="pun">固定速度：该类型将会以固定速度，触发任务调度；按照固定的间隔时间，周期性触发；</span></code></li><li class="L1"><code><span class="pln">        </span><span class="pun">固定延迟：该类型将会以固定延迟，触发任务调度；按照固定的延迟时间，从上次调度结束后开始计算延迟时间，到达延迟时间后触发下次调度；</span></code></li><li class="L2"><code><span class="pln">    </span><span class="pun">-</span><span class="pln"> CRON</span><span class="pun">：触发任务执行的</span><span class="typ">Cron</span><span class="pun">表达式；</span></code></li><li class="L3"><code><span class="pln">    </span><span class="pun">-</span><span class="pln"> </span><span class="pun">固定速度：固件速度的时间间隔，单位为秒；</span></code></li><li class="L4"><code><span class="pln">    </span><span class="pun">-</span><span class="pln"> </span><span class="pun">固定延迟：固件延迟的时间间隔，单位为秒；</span></code></li><li class="L5"><code></code></li><li class="L6"><code><span class="pun">任务配置：</span></code></li><li class="L7"><code><span class="pln">    </span><span class="pun">-</span><span class="pln"> </span><span class="pun">运行模式：</span></code></li><li class="L8"><code><span class="pln">        BEAN</span><span class="pun">模式：任务以</span><span class="typ">JobHandler</span><span class="pun">方式维护在执行器端；需要结合</span><span class="pln"> </span><span class="str">"JobHandler"</span><span class="pln"> </span><span class="pun">属性匹配执行器中任务；</span></code></li><li class="L9"><code><span class="pln">        GLUE</span><span class="pun">模式(</span><span class="typ">Java</span><span class="pun">)：任务以源码方式维护在调度中心；该模式的任务实际上是一段继承自</span><span class="typ">IJobHandler</span><span class="pun">的</span><span class="typ">Java</span><span class="pun">类代码并</span><span class="pln"> </span><span class="str">"groovy"</span><span class="pln"> </span><span class="pun">源码方式维护，它在执行器项目中运行，可使用</span><span class="lit">@Resource</span><span class="pun">/</span><span class="lit">@Autowire</span><span class="pun">注入执行器里中的其他服务；</span></code></li><li class="L0"><code><span class="pln">        GLUE</span><span class="pun">模式(</span><span class="typ">Shell</span><span class="pun">)：任务以源码方式维护在调度中心；该模式的任务实际上是一段</span><span class="pln"> </span><span class="str">"shell"</span><span class="pln"> </span><span class="pun">脚本；</span></code></li><li class="L1"><code><span class="pln">        GLUE</span><span class="pun">模式(</span><span class="typ">Python</span><span class="pun">)：任务以源码方式维护在调度中心；该模式的任务实际上是一段</span><span class="pln"> </span><span class="str">"python"</span><span class="pln"> </span><span class="pun">脚本；</span></code></li><li class="L2"><code><span class="pln">        GLUE</span><span class="pun">模式(</span><span class="pln">PHP</span><span class="pun">)：任务以源码方式维护在调度中心；该模式的任务实际上是一段</span><span class="pln"> </span><span class="str">"php"</span><span class="pln"> </span><span class="pun">脚本；</span></code></li><li class="L3"><code><span class="pln">        GLUE</span><span class="pun">模式(</span><span class="typ">NodeJS</span><span class="pun">)：任务以源码方式维护在调度中心；该模式的任务实际上是一段</span><span class="pln"> </span><span class="str">"nodejs"</span><span class="pln"> </span><span class="pun">脚本；</span></code></li><li class="L4"><code><span class="pln">        GLUE</span><span class="pun">模式(</span><span class="typ">PowerShell</span><span class="pun">)：任务以源码方式维护在调度中心；该模式的任务实际上是一段</span><span class="pln"> </span><span class="str">"PowerShell"</span><span class="pln"> </span><span class="pun">脚本；</span></code></li><li class="L5"><code><span class="pln">    </span><span class="pun">-</span><span class="pln"> </span><span class="typ">JobHandler</span><span class="pun">：运行模式为</span><span class="pln"> </span><span class="str">"BEAN模式"</span><span class="pln"> </span><span class="pun">时生效，对应执行器中新开发的</span><span class="typ">JobHandler</span><span class="pun">类“</span><span class="lit">@JobHandler</span><span class="pun">”注解自定义的</span><span class="pln">value</span><span class="pun">值；</span></code></li><li class="L6"><code><span class="pln">    </span><span class="pun">-</span><span class="pln"> </span><span class="pun">执行参数：任务执行所需的参数；</span><span class="pln">     </span></code></li><li class="L7"><code></code></li><li class="L8"><code><span class="pun">高级配置：</span></code></li><li class="L9"><code><span class="pln">    </span><span class="pun">-</span><span class="pln"> </span><span class="pun">路由策略：当执行器集群部署时，提供丰富的路由策略，包括；</span></code></li><li class="L0"><code><span class="pln">        FIRST</span><span class="pun">（第一个）：固定选择第一个机器；</span></code></li><li class="L1"><code><span class="pln">        LAST</span><span class="pun">（最后一个）：固定选择最后一个机器；</span></code></li><li class="L2"><code><span class="pln">        ROUND</span><span class="pun">（轮询）：；</span></code></li><li class="L3"><code><span class="pln">        RANDOM</span><span class="pun">（随机）：随机选择在线的机器；</span></code></li><li class="L4"><code><span class="pln">        CONSISTENT_HASH</span><span class="pun">（一致性</span><span class="pln">HASH</span><span class="pun">）：每个任务按照</span><span class="typ">Hash</span><span class="pun">算法固定选择某一台机器，且所有任务均匀散列在不同机器上。</span></code></li><li class="L5"><code><span class="pln">        LEAST_FREQUENTLY_USED</span><span class="pun">（最不经常使用）：使用频率最低的机器优先被选举；</span></code></li><li class="L6"><code><span class="pln">        LEAST_RECENTLY_USED</span><span class="pun">（最近最久未使用）：最久未使用的机器优先被选举；</span></code></li><li class="L7"><code><span class="pln">        FAILOVER</span><span class="pun">（故障转移）：按照顺序依次进行心跳检测，第一个心跳检测成功的机器选定为目标执行器并发起调度；</span></code></li><li class="L8"><code><span class="pln">        BUSYOVER</span><span class="pun">（忙碌转移）：按照顺序依次进行空闲检测，第一个空闲检测成功的机器选定为目标执行器并发起调度；</span></code></li><li class="L9"><code><span class="pln">        SHARDING_BROADCAST</span><span class="pun">(分片广播)：广播触发对应集群中所有机器执行一次任务，同时系统自动传递分片参数；可根据分片参数开发分片任务；</span></code></li><li class="L0"><code><span class="pln">    </span><span class="pun">-</span><span class="pln"> </span><span class="pun">子任务：每个任务都拥有一个唯一的任务</span><span class="pln">ID</span><span class="pun">(任务</span><span class="pln">ID</span><span class="pun">可以从任务列表获取)，当本任务执行结束并且执行成功时，将会触发子任务</span><span class="pln">ID</span><span class="pun">所对应的任务的一次主动调度。</span></code></li><li class="L1"><code><span class="pln">    </span><span class="pun">-</span><span class="pln"> </span><span class="pun">调度过期策略：</span></code></li><li class="L2"><code><span class="pln">        </span><span class="pun">-</span><span class="pln"> </span><span class="pun">忽略：调度过期后，忽略过期的任务，从当前时间开始重新计算下次触发时间；</span></code></li><li class="L3"><code><span class="pln">        </span><span class="pun">-</span><span class="pln"> </span><span class="pun">立即执行一次：调度过期后，立即执行一次，并从当前时间开始重新计算下次触发时间；</span></code></li><li class="L4"><code><span class="pln">    </span><span class="pun">-</span><span class="pln"> </span><span class="pun">阻塞处理策略：调度过于密集执行器来不及处理时的处理策略；</span></code></li><li class="L5"><code><span class="pln">        </span><span class="pun">单机串行（默认）：调度请求进入单机执行器后，调度请求进入</span><span class="pln">FIFO</span><span class="pun">队列并以串行方式运行；</span></code></li><li class="L6"><code><span class="pln">        </span><span class="pun">丢弃后续调度：调度请求进入单机执行器后，发现执行器存在运行的调度任务，本次请求将会被丢弃并标记为失败；</span></code></li><li class="L7"><code><span class="pln">        </span><span class="pun">覆盖之前调度：调度请求进入单机执行器后，发现执行器存在运行的调度任务，将会终止运行中的调度任务并清空队列，然后运行本地调度任务；</span></code></li><li class="L8"><code><span class="pln">    </span><span class="pun">-</span><span class="pln"> </span><span class="pun">任务超时时间：支持自定义任务超时时间，任务运行超时将会主动中断任务；</span></code></li><li class="L9"><code><span class="pln">    </span><span class="pun">-</span><span class="pln"> </span><span class="pun">失败重试次数；支持自定义任务失败重试次数，当任务失败时将会按照预设的失败重试次数主动进行重试；</span></code></li></ol></pre>
    </div>
</div>


<script>
    function plans(index) {
        $("#plansArea").html("");
        $.ajax({
            type: "POST",
            url: baseURL + "jobdesc/expression?count="+index,
            dataType: "json",
            data: {exp: $("#cron").val()},
            success: function (result) {
                if (result.code == 0) {
                    for(var i=0;i<result.data.length;i++){
                        var p = "<p>" + (i+1) + ".&nbsp;&nbsp;" + result.data[i] + "</p>";
                        $("#plansArea").append(p);
                    }
                } else {
                    layer.alert(result.msg);
                }
            }
        });
    }
</script>
</body>
</html>
